#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
int main(){
int id=fork();
if(id==0){
printf("I am child process.\n");
  sleep(5);
  exit(0);
}else{
  int status;
waitpid(id,&status,0);
if (WIFEXITED(status)) {
    printf("Child process exited normally with exit code: %d\n", WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) {
    int term_signal = WTERMSIG(status);
    printf("Child process was terminated by signal: %d\n", term_signal);
}
}
  return 0;
}
